From 951e194e9aede41bb044ccbedc58aa3740828bcb Mon Sep 17 00:00:00 2001 From: "maf46@burn.cl.cam.ac.uk" Date: Thu, 17 Feb 2005 21:06:48 +0000 Subject: [PATCH] bitkeeper revision 1.1203.1.1 (42150768_GVy_di2OIi0ljHAGVf4VA) Be careful to continue using the 1:1 pagetable if we take a vmexit before the vmx guest switches into protected/paged mode. --- BitKeeper/etc/logging_ok | 1 + xen/arch/x86/shadow.c | 8 ++++---- xen/arch/x86/vmx.c | 14 +++++++++++++- xen/arch/x86/vmx_io.c | 7 ++++++- 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok index 5a2b880b66..dd5943bb91 100644 --- a/BitKeeper/etc/logging_ok +++ b/BitKeeper/etc/logging_ok @@ -40,6 +40,7 @@ kaf24@striker.cl.cam.ac.uk kaf24@viper.(none) laudney@eclipse.(none) lynx@idefix.cl.cam.ac.uk +maf46@burn.cl.cam.ac.uk mafetter@fleming.research mark@maw48.kings.cam.ac.uk maw48@labyrinth.cl.cam.ac.uk diff --git a/xen/arch/x86/shadow.c b/xen/arch/x86/shadow.c index 90e19c5b08..dadce938b8 100644 --- a/xen/arch/x86/shadow.c +++ b/xen/arch/x86/shadow.c @@ -260,7 +260,7 @@ static int shadow_mode_table_op( ASSERT(spin_is_locked(&d->arch.shadow_lock)); SH_VLOG("shadow mode table op %p %p count %d", - pagetable_val(d->exec_domain[0]->arch.pagetable), /* XXX SMP */ + pagetable_val(d->exec_domain[0]->arch.guest_table), /* XXX SMP */ pagetable_val(d->exec_domain[0]->arch.shadow_table), /* XXX SMP */ d->arch.shadow_page_count); @@ -546,7 +546,7 @@ static void shadow_map_l1_into_current_l2(unsigned long va) if ( !(sl1ss & PSH_shadowed) ) { /* This L1 is NOT already shadowed so we need to shadow it. */ - SH_VVLOG("4a: l1 not shadowed ( %p )", sl1pfn); + SH_VVLOG("4a: l1 not shadowed ( %p )", sl1ss); sl1mfn_info = alloc_shadow_page(d); sl1mfn_info->u.inuse.type_info = PGT_l1_page_table; @@ -618,7 +618,7 @@ int shadow_fault(unsigned long va, long error_code) SH_VVLOG("shadow_fault( va=%p, code=%ld )", va, error_code ); - check_pagetable(d, ed->arch.pagetable, "pre-sf"); + check_pagetable(d, ed->arch.guest_table, "pre-sf"); /* * STEP 1. A fast-reject set of checks with no locking. @@ -708,7 +708,7 @@ int shadow_fault(unsigned long va, long error_code) shadow_unlock(d); - check_pagetable(d, ed->arch.pagetable, "post-sf"); + check_pagetable(d, ed->arch.guest_table, "post-sf"); return EXCRET_fault_fixed; } diff --git a/xen/arch/x86/vmx.c b/xen/arch/x86/vmx.c index dd53d5dbab..6b17946c7b 100644 --- a/xen/arch/x86/vmx.c +++ b/xen/arch/x86/vmx.c @@ -114,6 +114,7 @@ static int vmx_do_page_fault(unsigned long va, unsigned long error_code) unsigned long eip; unsigned long gpa; int result; + struct exec_domain *ed = current; #if VMX_DEBUG { @@ -124,6 +125,16 @@ static int vmx_do_page_fault(unsigned long va, unsigned long error_code) } #endif + /* + * If vpagetable is zero, then we are still emulating 1:1 page tables, + * and we should have never gotten here. + */ + if ( !ed->arch.vpagetable ) + { + printk("vmx_do_page_fault while still running on 1:1 page table\n"); + return 0; + } + gpa = gva_to_gpa(va); if (!gpa) return 0; @@ -810,7 +821,8 @@ asmlinkage void vmx_vmexit_handler(struct xen_regs regs) break; } default: - __vmx_bug(®s); + printk("unexpected VMexit for exception vector 0x%x\n", vector); + //__vmx_bug(®s); break; } break; diff --git a/xen/arch/x86/vmx_io.c b/xen/arch/x86/vmx_io.c index 9fbaa05298..e7f80bed45 100644 --- a/xen/arch/x86/vmx_io.c +++ b/xen/arch/x86/vmx_io.c @@ -380,8 +380,13 @@ void vmx_intr_assist(struct exec_domain *d) void vmx_do_resume(struct exec_domain *d) { + if ( d->arch.vpagetable ) + __vmwrite(GUEST_CR3, pagetable_val(d->arch.shadow_table)); + else + // we haven't switched off the 1:1 pagetable yet... + __vmwrite(GUEST_CR3, pagetable_val(d->arch.guest_table)); + __vmwrite(HOST_CR3, pagetable_val(d->arch.monitor_table)); - __vmwrite(GUEST_CR3, pagetable_val(d->arch.shadow_table)); __vmwrite(HOST_ESP, (unsigned long)get_stack_bottom()); if (event_pending(d)) { -- 2.30.2